package ModelLayer;
import java.util.ArrayList;


public class Staffs
{
    //instance variables
    private static Staffs instance = null;
    private static ArrayList<Staff> staffs;
   
    /**
     * Empty constructor for testing purposes
     */
    
    private Staffs()
    {
       staffs = new ArrayList<Staff>();
    }

    /**
     * Singleton static inplementation
     */
    
    public static Staffs getInstance()
    {
        if(instance == null)
      {
        instance = new Staffs();
      }
      return instance;
    }
   
    /**
     * Accessor and Mutator methods
     */
    
    public static void addStaff(Staff _staff)
    {
        staffs.add(_staff);
    }
    
    public static Staff getStaff(String _id)
    {
        Staff o = new Staff();
        for(int i = 0; i<staffs.size(); i++)  
        {
            if (staffs.get(i).getId().equals(_id))
                o = staffs.get(i);
        }
        return o;
    }
        
    public void listAllStaffs()
    {
        System.out.println("\nStaff:");
        for(int i = 0; i < staffs.size(); i++)
        {
            System.out.println("\nId: " + staffs.get(i).getId() +
                                "\nName: " + staffs.get(i).getName());
        }
    }
}
